<?php
/**
 * Created By PhpStorm
 * Author: patrick wu
 * Date: 2020/9/21
 * Time: 9:31
 */
namespace App\Rules;

use App\Http\Model\Mysql\ShopModel;
use Illuminate\Contracts\Validation\Rule;

class ShopRule implements Rule
{
    /**
     * 店铺验证规则
     * @param string $attribute
     * @param mixed $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
        return ShopModel::where(['id' => $value])->exists();
    }

    /**
     * 店铺验证错误信息
     * @return array|string
     */
    public function message()
    {
        return "店铺不存在";
    }
}
